<template>
    <div>
        <div class="width-75 b-c2 c-f p-b-7">
            <div class="flex z-header">
                <div @click="$router.back(-1)">
                    <i class="iconfont icon-zuo m-t-18"></i>
                </div>
                <div class="fs-36">
                    我的钱包
                </div>
                <div class="fs-30"> 
                    明细
                </div>
            </div>
            <div class="tc">
                <div class="fs-24 m-t-6">账户余额（元）</div>
                <div class="balance m-t-4">{{balance}}</div>
            </div>
        </div>
         <nav>
            <ul class="fs-30">
                <li class="bb-1-e">  
                    <div class="width-75 flex z-header" @click="recharge">
                        <div>
                            <i class="iconfont icon-56 fs-36"></i>
                            <span>充值</span>
                        </div>
                        <div>
                            <i class="iconfont icon-you1 fs-28"></i>
                        </div>
                    </div>  
                </li>
                <li class="bb-1-e">  
                    <div class="width-75 flex z-header">
                        <div @click="recharge">
                            <i class="iconfont icon-56 fs-36"></i>
                            <span>提现</span>
                        </div>
                        <div>
                            <i class="iconfont icon-you1 fs-28"></i>
                        </div>
                    </div>  
                </li>
            </ul>
        </nav>
        <div v-html="a" id="c">

        </div>
    </div>
</template>
<script>
import { z } from '../assets/js/common'
    export default {
        data() {
            return{
                balance:0,
                htmls:""
            }     
        },
        methods: {
          Wallet(){
              this.$http({
                    method: 'post',
                    url: localPath + '/pay/getWallet'
                }).then((data)=>{
                    // 把后台的数据保存到this.schoolkind里面
                     
                     this.balance = data.data.balance;
                }).catch((error)=>{
                    console.log(error);
                })
          },

        //   充值
          recharge(){
                var params = new URLSearchParams();
                params.append("price", 0.01);
            
                this.$http({
                    method: 'post',
                    url: localPath + '/pay/aliPay',
                    data:params
                }).then((data)=>{
                    // 把后台的数据保存到this.schoolkind里面
                     console.log(data);
                    //  保存返回回来的
                    //   localStorage.setItem('forms',JSON.stringify(data.data.message));
                    // payHtml = JSON.stringify(data.data.message);
                    
                    
                     //返回参数 
//              let routerData = this.$router.resolve({path:'/pay',query:{'htmls':data.data.message}})
                 payHtml = data.data.message

                 this.$router.push({ path: '/pay'});
                 //打开新页面
//                  window.open(routerData.href,'_ blank')
                  
                     
                 }).catch((error)=>{
                    console.log(error);
                })

          }
        },
        mounted() {
            this.Wallet();
            
            document.addEventListener(z());
        }
    }

</script>
<style>
.balance{
    font-size: 1rem;
}
</style>
